<!DOCTYPE html>
<html>

	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<meta charset="utf-8">
		<meta name="robots" content="noarchive">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>快递单号管理</title>
		<meta content="会员中心" name="keywords">
		<meta content="会员中心" name="description">
		<!-- base href="http://www.zhuanzhuanduo.com/" -->
		<!--<link href="templates/400011/skins/default/member.css" rel="stylesheet" type="text/css" />-->
		<script src="js/jquery.js"></script>
		<script src="js/base.js" id="jsbase" source="ysr"></script>
		<script src="sj/layer.js"></script>
		<link rel="stylesheet" type="text/css" href="css/bootstrap-datetimepicker.css">
		<script type="text/javascript" src="js/bootstrap-datetimepicker.js"></script>
		<script type="text/javascript" src="js/bootstrap-datetimepicker_002.js"></script>
		<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
		<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.css">
		<link rel="stylesheet" type="text/css" href="css/common.css">
		<link rel="stylesheet" type="text/css" href="css/module.css">
		<link rel="stylesheet" type="text/css" href="css/global2471.css">
		<script type="text/javascript" src="js/bootstrap.js"></script>
		<link rel="stylesheet" type="text/css" href="css/base.css">
		<link rel="stylesheet" type="text/css" href="css/business.css">
		<script type="text/javascript" src="js/global.js"></script>
		<link rel="stylesheet" type="text/css" href="css/releasetaskf700.css">
		<script type="text/javascript" src="js/image.js"></script>
		<script type="text/javascript" src="js/jquery_002.js"></script>

		<script type="text/javascript" src="js/main.js"></script>
	</head>

	<body>
		<div class="global-prompt" id="global-prompt"></div><img id="buffer" src="images/buffer.gif" style="top: 475px; left: 982.5px;">
		<div id="mask"></div>
		<div id="header" style="padding:0px;">
			<div class="top top-login">
				<div class="w-1k f-cb">
					<ul class="f-cb f-fr">
						<li class="f-fl  p-r">
							<div>
								<!--                         <a class="tp-nv">
                            <img src="templates/400011/skins/default/resources/images/level/seller_1.png" style="padding-left:13px;">
                        </a> -->
								<a class="tp-nv" style="padding-right:13px;" href="http://www.zhuanzhuanduo.com/member/shopaccount.php" id="div-uname">
									13592507037 </a>
							</div>
						</li>
						<li class="f-fl">
							<span class="tp-nv v-bar" style="padding-left:0px;">|</span>
						</li>
						<li class="f-fl">
							<a class="tp-nv" href="http://www.zhuanzhuanduo.com/pay/showpayment.php?tab=online" title="账户中心">本金：
								<span class="ye" id="div-seller-benjin">34.00</span>元</a>
							<a class="striking" title="账户充值" href="http://www.zhuanzhuanduo.com/pay/showpayment.php?tab=online"> 充值</a>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;佣金：
							<span class="ye" id="div-seller-benjin1">10.00</span>金
							<a class="striking" title="账户充值" href="http://www.zhuanzhuanduo.com/pay/pay.php"> 充值</a>
						</li>
						<li class="f-fl">
							<span class="tp-nv v-bar" style="padding-left:13px;padding-right:13px;">|</span>
						</li>
						<li class="f-fl">
							<a style="display:block;" href="http://www.zhuanzhuanduo.com/member/logout.php"><span>退出</span></a>
						</li>
						<li class="f-fl">
							<span class="tp-nv v-bar" style="padding-left:13px;padding-right:13px;">|</span>
						</li>
						<li class="f-fl">
							<a class="edit_pwd" data-toggle="modal" data-target=".change_pwd">修改密码</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
		<div id="navgation" style="padding:0px 0px 15px 0px;">
			<div class="hd">
				<div class="w-1k f-cb p-r">
					<a href="http://www.zhuanzhuanduo.com/member/index.php"><img class="logo" src="images/logo.jpg"></a>
					<ul class="f-cb f-fr f-fr-navtab">
						<!--<li class="f-fl "><a class="hd-nv a_mehome active" href="/member/index.php">商家中心</a></li>-->
					</ul>
				</div>
			</div>
		</div>

		<div class="w-1k" style="margin-top: 10px;margin-bottom: 10px;text-align: center;" id="div-new-article"></div>
		<link rel="stylesheet" type="text/css" href="css/taskmanagef700.css">
		<link rel="stylesheet" type="text/css" href="css/taskdetail.css">
		<link rel="stylesheet" href="css/viewer.css">
		<script type="text/javascript" src="js/order_view.js"></script>
		<script type="text/javascript" src="js/clipboard.js"></script>
		<style>
			.loading {
				position: fixed;
				top: 0;
				right: 0;
				bottom: 0;
				left: 0;
				z-index: 1050;
				display: none;
				overflow: auto;
				overflow-y: scroll;
				-webkit-overflow-scrolling: touch;
				outline: 0;
			}
		</style>

		<script>
			function disabledInput(id) {
				$('#' + id).find('input').prop("disabled", true);
				$('#' + id).find('.divExpressNo').prop("disabled", true);
				$('#' + id).find(".copyexpress").prop("disabled", false);
				$('#' + id).find(".choose_one").prop("disabled", false);
			}
		</script>

		<div class="w-1k main">
			<div class="tm-tab f-pr">
				<div class="f-cb">
					<a class="f-fl mntab a_task_list" href="http://www.zhuanzhuanduo.com/member/index.php">首页</a>
					<a class="f-fl mntab a_task_list " href="http://www.zhuanzhuanduo.com/member/shopquest.php">垫付任务管理</a>
					<a class="f-fl mntab a_order_list_refund " href="http://www.zhuanzhuanduo.com/member/refund.php?status=3">垫付任务返款管理</a>
					<a class="f-fl mntab a_order_list_express act" href="http://www.zhuanzhuanduo.com/member/express.php">快递单号管理</a>
					<a class="f-fl mntab a_order_list " href="http://www.zhuanzhuanduo.com/member/order_list.php">垫付进行中订单</a>
					<a class="f-fl mntab a_order_list_history " href="http://www.zhuanzhuanduo.com/member/order_history.php?status=6">垫付历史订单</a>
					<a class="f-fl mntab a_order_list_all " href="http://www.zhuanzhuanduo.com/member/order_all.php">进行及历史订单</a>
				</div>
			</div>
			<div class="exp-lst-hd f-cb" style="margin-top: 10px">
				<span style="color: red;font-weight: bold;padding-left: 1em;">垫付任务返款管理里面的订单确认返款后，对应的订单信息才会展示到快递单号管理里面。</span>
			</div>

			<form class="query-form" id="queryForm" action="member/express.php">
				<div class="col">
					<label style="padding-left:10px">店铺：</label>
					<select name="shopId" id="shopId">
						<option value="" selected="selected">全部</option>
						<option value="2248">低价百姓服饰店</option>
					</select>
				</div>
				<div class="col">
					<label style="padding-left:10px">快递获取状态：</label>
					<select name="orderStatus" id="orderStatus">
						<option value="0" selected="selected"></option>
						<option value="1">未获取</option>
						<option value="2">已获取</option>
					</select>
				</div>

				<div class="col">
					<label>接单时间：</label>
					<input type="text" class="Wdate" name="stime" id="stime" style="width:100px" placeholder=""> 到
					<input type="text" class="Wdate" name="etime" id="etime" style="width:100px" placeholder="">
				</div>
				<div class="col">
					<label>商家确认返款时间：</label>
					<input type="text" class="Wdate" name="cstime" id="cstime" style="width:100px" placeholder=""> 到
					<input type="text" class="Wdate" name="cetime" id="cetime" style="width:100px" placeholder="">
				</div>
				<div class="col">
					<label>任务ID：</label><input type="text" name="taskId" id="taskId" placeholder="">
				</div>
				<div class="col">
					<label>订单ID：</label><input type="text" name="orderId" id="orderId" placeholder="">
				</div>
				<div class="col">
					<label>第三方订单ID：</label><input type="text" name="tbOrderId" id="tbOrderId" placeholder="淘宝、京东、拼多多等ID">
				</div>
				<div class="col">
					<label style="padding-left:10px">快递发货状态：</label>
					<select name="expressStatus" id="expressStatus">
						<option value="0" selected="selected"></option>
						<option value="1">未发货</option>
						<option value="2">已发货</option>
					</select>
				</div>
				<div class="col">
					<button class="btn btn-search">搜索</button>
				</div>
				<input type="hidden" name="pageCount" value="10">
			</form>

			<!--<form class="searchorder" id="" action="#" method="GET">-->
			<!--<table >-->
			<!--</table>-->
			<!--</form>-->

			<div class="exp-lst-hd f-cb" style="margin-top: 80px">
				<span style="color: red;font-weight: bold;padding-left: 1em;">获取单号前务必核对下单号，收发货信息与下单地址是否一致</span>
				<span class="prompt f-fr" style="color: red">如需导出请购买快递后，到垫付进行中订单筛选后导出。</span>
			</div>

			<div class="exp-lst">
				<div style="margin-bottom: 8px">
					<input type="checkbox" id="checkall"><span style="position: relative;left: 5px;margin-right: 20px">全选</span>
					<label>单页数量：</label>
					<select name="pageCount" id="pageCount">
						<option value="10" selected="selected">10</option>
						<option value="20">20</option>
						<option value="100">100</option>
					</select>
					<a class="btn" style="background:#0098E1;color: #FFF;position: relative;left: 15px;margin-right: 20px;" data-toggle="modal" data-target=".shop_seeting" data-id="" data-pay="">批量修改</a>
					<a class="btn" style="background:#0098E1;color: #FFF" onclick="expressMultiGet()">批量获取单号</a>
					<a class="btn" style="background:#0098E1;color: #FFF" onclick="deliveryMultiSet()">批量处理发货</a>
					<div style="text-align:right;margin-top: -34px">
						<a class="btn" style="background:#0098E1;color: #FFF" href="http://www.zhuanzhuanduo.com/member/shopaccount.php">设置发货信息</a>&nbsp;
					</div>

				</div>
			</div>

			<div class="pag f-cb">
				<div class="text-center page aligncenter">
					<div id="pages">
						<span class="page_title">暂无记录</span> </div>
				</div>
			</div>

			<div class="modal fade shop_seeting" id="shop_seeting" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<form class="form-horizontal" action="#" method="post" id="form1">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
								<h4 class="modal-title" id="myModalLabel">批量修改</h4>
							</div>
							<div class="modal-body">
								<input type="hidden" id="customerTaskId" name="customerTaskId">
								<div class="text-center form-group" style="margin-top: 15px;">
									<div class="col-sm-10 clearfix">
										发件人姓名：<input type="text" id="sendname" name="sendname" style="width:150px;height:30px">
									</div>
									<div class="col-sm-10" style="margin-top: 5px">
										商品名称：<input type="text" id="shopname" name="shopname" style="width:150px;height:30px;margin-left: 10px">
									</div>
									<div class="col-sm-10" style="margin-top: 5px">
										商品重量：<input type="text" id="shopweight" name="shopweight" style="width:150px;height:30px;margin-left: 10px">
									</div>
								</div>
							</div>

							<div class="modal-footer" style="text-align: center;">
								<button type="button" class="btn btn-default" id="bsubmit">
                            <span class="glyphicon glyphicon-ok" style="color: green"></span>&nbsp;确认提交
                        </button>
								<button type="button" class="btn btn-default" data-dismiss="modal">
                            <span class="glyphicon glyphicon-remove" style="color: #ff0000"></span>&nbsp;取消退出
                        </button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
		<div id="copyTarget" style="opacity: 0;"></div>
		<!--隐藏目标对象-->

		<div class="modal fade express_prompt" id="express_prompt" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
						<h4 class="modal-title">购买确认</h4>
					</div>
					<div class="modal-body">
						<p style="line-height: 25px;">确定获取圆通快递单号？</p>
						<p style="line-height: 25px;">价格为2元/单，将直接从本金扣除。</p>

					</div>
					<div class="modal-footer" style="text-align: center;">
						<input type="checkbox" id="todayprompt"><span style="position: relative;left: 5px;margin-right: 20px">今日不再提示</span>
						<button type="submit" class="btn btn-default" onclick="buyExpress()">
                    <span class="glyphicon glyphicon-ok" style="color: green"></span>&nbsp;确认提交
                </button>
						<button type="button" class="btn btn-default" data-dismiss="modal">
                    <span class="glyphicon glyphicon-remove" style="color: #ff0000"></span>&nbsp;取消退出
                </button>
					</div>
				</div>
			</div>
		</div>
		<!--
<div class="loading" id="loading">
    <iframe name="" border="0" src="images/loading.htm" width="100%" height="100%" frameborder="no"></iframe>
</div>-->

		<script>
			var all = document.getElementById('checkall');
			var chooseone = document.getElementsByClassName('choose_one');
			all.onclick = function() {
				if(all.checked == true) {
					for(var i = 0; i < chooseone.length; i++) {
						chooseone[i].checked = true;
					}
				} else {
					for(var i = 0; i < chooseone.length; i++) {
						chooseone[i].checked = false;
					}
				}
			};
			for(var i = 0; i < chooseone.length; i++) {
				chooseone[i].onclick = function() {
					var flag = true;
					for(var j = 0; j < chooseone.length; j++) {
						if(chooseone[j].checked == false) {
							flag = false;
						}
					}
					all.checked = flag;
				};
			}

			$("#pageCount").change(function() {
				var opt = $("#pageCount").val();
				var url = "/member/express.php";
				if(url.indexOf('?') != -1) {
					window.location.href = url + "&pageCount=" + opt;
				} else {
					window.location.href = url + "?pageCount=" + opt;
				}

			});

			$("#bsubmit").click(function() {
				$('#shop_seeting').modal('toggle');
				var sendname = $('#sendname').val();
				var shopname = $('#shopname').val();
				var shopweight = parseFloat($('#shopweight').val());

				if(shopweight < 0.05 || shopweight > 40) {
					alert("重量请设置在0.05-40KG之间！");
					return;
				}

				var sname = document.getElementsByName("sName");
				var productName = document.getElementsByName("productName");
				var weight = document.getElementsByName("weight");
				var isuseexpress = document.getElementsByName("isuseexpress");
				var choose = document.getElementsByName("choose_one");

				var index = 0;
				for(var i = 0; i < sname.length; i++) {
					// sname[i].value = sendname;
					if(isuseexpress[i].value == 0) {
						if(choose[index].checked) {
							if(sendname != "" && sendname != null && sendname != undefined) {
								sname[i].value = sendname;
							}
							if(shopname != "" && shopname != null && shopname != undefined) {
								productName[i].value = shopname;
							}
							if(shopweight != "" && shopweight != null && shopweight != undefined && shopweight > 0) {
								weight[i].value = shopweight;
							}
						}

						index++;
					}
				}
			});

			function deliveryMultiSet() {
				var useExpressCount = 0;
				var chooseCount = 0;
				var needPay = 0;
				var form = document.getElementsByName("express-form");
				var dataJson = new Array();
				for(var i = 0; i < form.length; i++) {
					var isNeedSave = true;
					var item = form[i];
					var temp = item.getElementsByClassName("choose_one");
					if(temp.item(0) && temp.item(0).checked) {
						chooseCount++;
						var tempArray = new Object();
						for(j = 0; j < item.length; j++) {
							if(item[j].name != '') {
								tempArray[item[j].name] = item[j].value;
								if(item[j].name == 'expressNo') {
									tempArray['expressPrice'] = item[j].options[0].getAttribute("price");
									needPay += parseFloat(item[j].options[0].getAttribute("price"));
								} else if(item[j].name == 'isuseexpress' && item[j].value == 1) {
									useExpressCount++;
								}
							}
						}
						dataJson.push(tempArray);
					}
				}

				if(chooseCount < 1) {
					layer.msg('当前没有勾选要处理的订单');
					return;
				}

				var prompText = '确定批量处理发货？';
				if(useExpressCount < chooseCount) {
					prompText = '部分订单未获取快递服务，是否确定批量处理发货？'
				}

				layer.confirm(prompText, {
					btn: ['确定', '取消'] //按钮
				}, function() {
					document.getElementById("loading").style.display = 'block';
					$.ajax({
						type: "POST",
						url: "/member/express.php?delivery=1",
						data: {
							'data': dataJson
						},
						dataType: 'json',
						success: function(d) {
							window.location.reload();
						},
						error: function(d) {
							// alert(d.Message);
						},
						complete: function() {
							document.getElementById("loading").style.display = 'none';
						}
					})

				});

			}

			function expressMultiGet() {
				var chooseCount = 0;
				var needPay = 0;
				var form = document.getElementsByName("express-form");
				var dataJson = new Array();
				for(var i = 0; i < form.length; i++) {
					var isNeedSave = true;
					var item = form[i];
					var temp = item.getElementsByClassName("choose_one");
					if(temp.item(0) && temp.item(0).checked) {
						chooseCount++;
						var tempArray = new Object();
						for(j = 0; j < item.length; j++) {
							if(item[j].name != '') {
								tempArray[item[j].name] = item[j].value;
								if(item[j].name == 'expressNo') {
									tempArray['expressPrice'] = item[j].options[0].getAttribute("price");
									needPay += parseFloat(item[j].options[0].getAttribute("price"));
								}
								if(item[j].name == 'isuseexpress' && item[j].value == 1) {
									isNeedSave = false;
								}
							}
						}
						if(isNeedSave) {
							dataJson.push(tempArray);
						}
					}
				}
				if(chooseCount < 1) {
					layer.msg('当前没有勾选要获取的订单');
					return;
				}

				layer.confirm('确定批量获取当前页圆通快递单号？<br>' + '价格为' + 2 + '元/单，将直接从本金扣除。<br><br>' +
					'<span style="color: red">当前勾选' + chooseCount + '单，将扣除' + needPay + '元</span>', {
						btn: ['确定', '取消'] //按钮
					},
					function() {
						layer.closeAll('dialog');
						// layer.msg('的确很重要', {icon: 1});
						document.getElementById("loading").style.display = 'block';
						$.ajax({
							type: "POST",
							url: "/member/upload_express.php",
							data: {
								'data': dataJson
							},
							dataType: 'json',
							success: function(d) {
								var isError = false;
								if(Array.isArray(d)) {
									isError = d[0].IsError;
								} else {
									isError = d.IsError;
								}

								if(!isError) {
									for(var i = 0; i < d.length; i++) {
										$('#span_' + d[i].OrderNo).html('运单号：' + d[i].WaybillNo);
										$('#isuseexpress_' + d[i].OrderNo).val(1);
										$('#span_' + d[i].OrderNo).show();
										$('#striking_' + d[i].OrderNo).hide();
									}
									window.location.reload();
								} else {
									alert(d.Message);
								}
							},
							error: function(d) {
								// alert(d.Message);
							},
							complete: function() {
								document.getElementById("loading").style.display = 'none';
							}
						})

					});

			}

			var expressJson = {};
			var opobj;
			$('.getexpress').on('click', function() {
				var e = $(this);
				opobj = e;
				var expressSelect = e.parents('.exp-item-tb').find('.divExpressNo');
				var price = expressSelect.find("option:selected").attr("price");

				var shopweight = e.parents('.exp-item-tb').find('.weight').val();
				if(shopweight < 0.05 || shopweight > 40) {
					alert("重量请设置在0.05-40KG之间！");
					return;
				}

				var form = e.parents('form');
				var data = form.serializeArray();
				for(var i = 0; i < data.length; i++) {
					expressJson[data[i]['name']] = data[i]['value'];
				}
				expressJson['expressPrice'] = price;

				if(getCookie("expressPrompt")) {
					buyExpress(e);
				} else {
					$('#express_prompt').modal('toggle');
				}
			});

			function buyExpress() {
				$('#express_prompt').hide();
				opobj.attr({
					"disabled": "disabled"
				});

				if(document.getElementById("todayprompt").checked) {
					register("expressPrompt", true);
					$('#todayprompt').attr("checked", false);
				}

				$.ajax({
					type: "POST",
					url: "/member/upload_express.php",
					data: {
						'data': {
							expressJson
						}
					},
					dataType: 'json',
					success: function(d) {
						var isError = false;
						if(Array.isArray(d)) {
							isError = d[0].IsError
						} else {
							isError = d.IsError
						}

						if(!isError) {
							disabledInput('express_' + d[0].OrderNo);

							// var ep = e.parent();
							// ep.find('span').html('运单号：' + d[0].WaybillNo).show();
							// $('#check_' + d[0].OrderNo).hide();
							// $('#isuseexpress_' + d[0].OrderNo).val(1);
							// ep.find('.getexpress').hide();

							window.location.reload();
						} else {
							alert(d.Message);
						}
					},
					error: function(d) {
						alert(d[0].Message);
					},
					complete: function() {
						opobj.removeAttr("disabled");
					}
				})
			}

			var copyObj = document.getElementsByClassName("copyexpress");
			for(var i = 0; i < copyObj.length; i++) {
				(function(i) {
					var clipboard = new Clipboard(copyObj[i], {
						text: function() {
							return copyObj[i].getAttribute("data-express");
						}
					});
				})(i);
			}
		</script>

		<link rel="stylesheet" type="text/css" href="css/style.css">
		
		<script>
			getImgvcode();
			getVcode(1);
			$(".cancle").click(function() {
				$(".box-mask").hide();
				$("#imgvcode").val('');
			})
		</script>

		
		</div>
	</body>
	

</html>